package com.linzm.biz.user;

import com.linzm.annotation.*;
import com.linzm.aspect.AbstractAspect;
import com.linzm.aspect.IJoinPoint;

/**
 * @Date: 2023/11/9 19:37
 * @User linziming
 */
@Aspect
@Component
public class UserAspect extends AbstractAspect {
    @Pointcut("com.lin.biz.user.*")
    private void myPointcut() {

    }

    @Before(value = "myPointcut()")
    public void before() {
        System.out.println("前置通知....");

    }

    @After(value = "myPointcut()")
    public void after() {
        System.out.println("后置通知....");

    }

    @AfterReturning(value = "myPointcut()")
    public void afterReturning(Object returnVal) {
        System.out.println("后置返回通知....result:" + returnVal.toString());
    }

    @Around(value = "")
    public Object around(IJoinPoint joinPoint) {
        System.out.println("环绕通知start....");
        Object obj = joinPoint.proceed();
        System.out.println("环绕通知end....");
        return obj;
    }

    //@AfterThrowing(value = "myPointcut()")
    public void afterThrowable(Throwable e) {
        System.out.println("异常通知....");
        e.printStackTrace();
    }
}
